﻿using System;
using System.Globalization;

using FireBus.Core.Properties;


namespace FireBus.Core
{
	public class ResourcesMessageAccessor : IMessageAccessor
	{
		public String ExtensionWithGivenNameAlreadyExists(String extensionName)
		{
			return Format(
				Resources.ExtensionWithGivenNameAlreadyExist,
				extensionName);
		}


		public String ExtensionWithGivenNameWasLoadedAlready(String extensionName)
		{
			return Format(
				Resources.ExtensionWithGivenNameWasLoadedAlready,
				extensionName);
		}

		public String ExtensionWithGivenNameDoesNotExist(String extensionName)
		{
			return Format(
				Resources.ExtensionWithGivenNameDoesNotExist,
				extensionName);
		}

		public String ExtensionDoesNotImplementInterfaceForEvent(String extensionName, String eventType)
		{
			return Format(
				Resources.ExtensionDoesNotImplementInterfaceForEvent,
				extensionName,
				eventType);
		}

		public String ExtensionDoesNotImplementInterfaceForRequestListener(
			String extensionName, String requestType, String responseType)
		{
			return Format(
				Resources.ExtensionDoesNotImplementInterfaceForRequestListener,
				extensionName,
				requestType,
				responseType);
		}

		public String AsyncResultStateCanBeSetOnlyOnce()
		{
			return Resources.AsyncResultStateCanBeSetOnlyOnce;
		}

		private static String Format(String format, params Object[] args)
		{
			return String.Format(
				CultureInfo.CurrentCulture,
				format,
				args);
		}
	}
}
